package _2接口;

public class TestDemo {

	// Thread.sleep() 会抛出 InterruptedException 异常
	// 当前在方法声明处添加 throws InterruptedException 不处理
	public static void main(String[] args) throws InterruptedException 
	{
	
		// 例子
		
		// 婴儿 
		// 母亲 
		// 父亲
		
		Baby b = new Baby();
		BabySister bs = new BabySister();
//		Mother m = new Mother();
//		Father f = new Father();
		
//		b.myMother = m;
//		b.myFather = f;
		
//		b.feedMan = f;
		b.feedMan = bs;

		while(b.isAlive())
		{
			// 饥饿度增加
			b.setHungry(b.getHungry()+10);
			System.out.println("婴儿的饥饿度:"+b.getHungry());
			
			// 等待500ms
			Thread.sleep(500);
		}
		

	}

}
